Don't force displayname if backend already provides one#3507
Merged
LukasReschke merged 1 commit intoFeb 16, 2017
Merged
Conversation
Member
Author
|
The SAML app will have integration tests for this. Am currently working on it at https://github.com/nextcloud/user_saml/compare/attributes-to-map-for. |
rullzer
approved these changes
Feb 16, 2017
blizzz
reviewed
Feb 16, 2017
| if (self::getUser() !== $uid) { | ||
| self::setUserId($uid); | ||
| self::setDisplayName($uid); | ||
| $setDisplayName = true; |
Member
There was a problem hiding this comment.
var name is not very clear. My suggestion is to rename to "setUidAsDisplayName" or "useUidAsDisplayName"
| && $backend->implementsActions(OC_User_Backend::GET_DISPLAYNAME)) { | ||
|
|
||
| $backendDisplayName = $backend->getDisplayName($uid); | ||
| if(is_string($backendDisplayName) && $backendDisplayName !== '') { |
Member
There was a problem hiding this comment.
trim($backendDisplayName) !== '', just in case?
`\OC_User::loginWithApache` is used in combination with backend mechanisms like our SSO / SAML integration. Those can optionally already provide a displayname using other means. For example by mapping SAML attributes. The current approach makes it however impossible for backends using `\OCP\Authentication\IApacheBackend` to set a displayname on their own. Because the display name will simply be overwritten with the loginname. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
3dd6379 to
92c74d2
Compare
Member
Author
|
@blizzz Adjusted 😉 |
blizzz
approved these changes
Feb 16, 2017
This was referenced Feb 16, 2017
|
Just tested the patch with git latest (server+user_saml) - works as expected. 2 side notes:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
\OC_User::loginWithApacheis used in combination with backend mechanisms like our SSO / SAML integration. Those can optionally already provide a displayname using other means. For example by mapping SAML attributes.The current approach makes it however impossible for backends using
\OCP\Authentication\IApacheBackendto set a displayname on their own. Because the display name will simply be overwritten with the loginname.Signed-off-by: Lukas Reschke lukas@statuscode.ch